home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Collection of Tools & Utilities
/
Collection of Tools and Utilities.iso
/
basic
/
qbnws105.zip
/
DAZZLING.ZIP
/
DAZZLING.BAS
< prev
next >
Wrap
BASIC Source File
|
1990-11-22
|
16KB
|
422 lines
' +===================================================+
' | DAZZLING.BAS |
' | Written and Developed by: |
' | Lawrence Stone |
' | |
' | Copyright (C), 1990 |
' | Lawrence Stone |
' | All Rights Reserved |
' | |
' | The code in this module is for the exclusive |
' | use of readers of the QBNews or any QuickBASIC, |
' | BASCOM, or PDS programmer. The source code and |
' | object modules derived from this code may be |
' | freely distributed without the express written |
' | permission of the author. |
' | |
' | Donations of appreciation for this author's |
' | work are gladly accepted. Please, no donations |
' | over $10,000 <GRIN>. |
' | |
' | Lawrence Stone November 22, 1990 |
' | P.O. Box 5715 |
' | Charleston, OR 97420 |
' +---------------------------------------------------+
'
' +===================================================+
' | Compile swithces: bc dazzling /o; |
' +---------------------------------------------------+
' $INCLUDE: 'DAZZLING.BI'
SUB Curtains (Direction%, Arry%()) STATIC
' Arry%() The screen image array.
'
' Direction = odd Curtains close from outside toward inside.
' Direction = even Curtains open from inside toward outside.
'
' Monitor -+------ Must be DIM SHARED or COMMON SHARED in main module.
' ScrnEls /
Start = 79: finish = 159
StepCount = 2
start2 = 1: finish2 = ScrnEls * 2
StepCount2 = 160
Direction = Direction MOD 2 'Force Direction into a "1" or "0".
IF Direction THEN
SWAP Start, finish
StepCount = -StepCount
SWAP start2, finish2
finish2 = finish2 - 1
StepCount2 = -StepCount2
END IF
FOR N = Start TO finish STEP StepCount
DEF SEG = Monitor
FOR J = start2 TO finish2 STEP StepCount2
IF (N + J) \ 2 < ScrnEls THEN 'Prevents subscript out of range.
'---- Right side of screen.
OneByte = Arry((N + J) \ 2) AND &HFF 'Extract high byte.
count = &H0 - Direction + J + N
GOSUB CurtainPoke
OneByte = (Arry((N + J) \ 2) AND &HFF00) \ 256 'Extract low.
count = &H0 + 1 - Direction + N + J
GOSUB CurtainPoke
'---- Left side of screen.
I = (79 - N) * 2
OneByte = Arry((N + J + I) \ 2) AND &HFF 'Extract high byte.
count = &H0 - Direction + J + I + N
GOSUB CurtainPoke
OneByte = (Arry((N + J + I) \ 2) AND &HFF00) \ 256'Extract low.
count = &H0 + 1 - Direction + N + J + I
GOSUB CurtainPoke
END IF
NEXT
DEF SEG 'We must return to BASIC's segment before we call TickPause.
IF N MOD 3 THEN TickPause 1 'A short delay for effect.
NEXT
EXIT SUB
CurtainPoke:
POKE count, OneByte
RETURN
END SUB
SUB Dazzle (Operation%, Direction%, Arry%()) STATIC
' Operation Description
' --------- ---------------------------------
' 0 Pull Full Screen Restore
' 1 Dazzled with Stair Steps
' 2 Dazzled with 8 Vertical Blinds
' 3 Dazzled with 4 Vertical Blinds
' 4 Dazzled with Slots
' 5 Dazzled with Diagonal Fills
' 6 Dazzled with Side Slides
' 7 Dazzled with Rolling Grates
' 8 Dazzled with Venetian Blinds
'
' Direction = odd Screen restore is left to right or, top to bottom
' Direction = even Screen restore is right to left or, bottom to top
'
' Arry%() Screen array
'
' MaxLine \
' Monitor -+------ Must be DIM SHARED or COMMON SHARED in main module.
' ScrnEls /
GOSUB InitDazzle
FOR J = Start TO finish STEP StepCount 'Force a dazzle.
DEF SEG = Monitor 'Define segment address.
FOR N = J TO finish2 STEP StepCount2
High = Arry(N \ 2) AND &HFF 'Extract the high byte.
Low = (Arry(N \ 2) AND &HFF00) \ 256 'Extract the low byte.
POKE &H0 - 1 + N, High 'POKE the high byte (color attr).
POKE &H0 + N, Low 'POKE the low byte (character).
' Slow pull down/up windows needed for compiled code if you
' don't want it to just "flash" onto the monitor.
IF Operation = 0 AND N MOD 479 = 0 THEN
DEF SEG
TickPause 1
DEF SEG = Monitor
END IF
NEXT
DEF SEG 'Back to BASIC.
'**** Short Pause for added effect.
IF Operation < 4 THEN
TickPause 1
ELSEIF Operation > 7 THEN
IF J MOD 199 = 0 THEN TickPause 1
ELSEIF Operation = 7 THEN
IF J MOD 7 = 0 THEN TickPause 1
ELSEIF Operation <> 0 THEN
IF J MOD 3 = 0 THEN TickPause 1
END IF
NEXT
EXIT SUB
InitDazzle:
StepCount = 2: Start = 1: finish2 = ScrnEls * 2
SELECT CASE Operation
CASE 0 'Pull Full Screen Restore
finish = 1: StepCount2 = finish + 1
IF Direction MOD 2 THEN
Start = finish2 + 1: finish = Start
finish2 = 0: StepCount2 = -StepCount2
END IF
CASE 1 'Dazzled Stair Steps
finish = 42: StepCount2 = finish - 4
CASE 2 'Dazzled with 8 Vertical Blinds
finish = 20: StepCount2 = finish
CASE 3 'Dazzled with 4 Vertical Blinds
finish = 40: StepCount2 = finish
CASE 4 'Dazzled with Slots
finish = 119: StepCount2 = finish - 1
CASE 5 'Dazzled by Diagonal Fills
finish = 82: StepCount2 = finish
CASE 6 'Dazzled by Side Slides
finish = 160: StepCount2 = finish
CASE 7 'Dazzled by Rolling Grates
finish = 320: StepCount2 = finish
CASE 8 'Dazzled with Venetian Blinds
finish = 80 * MaxLine - MaxLine
finish = finish - (finish MOD 160) + 160
StepCount2 = finish
StepCount2 = StepCount2 + (StepCount2 MOD 80)
CASE ELSE
END SELECT
IF Direction MOD 2 = 0 AND Operation% <> 0 THEN
SWAP Start, finish
IF NOT Operation = 4 THEN Start = Start - 1
StepCount = -StepCount
END IF
RETURN
END SUB
SUB GetMonitorSeg
' Monitor Must be DIM SHARED or COMMON SHARED in main module.
DEF SEG = 0
IF (PEEK(&H410) AND &H30) = &H30 THEN Monitor = &HB000 ELSE Monitor = &HB800
DEF SEG
END SUB
SUB Implode (Arry%()) STATIC
' Arry%() The screen image array.
'
' Direction = odd Curtains close from outside toward inside.
' Direction = even Curtains open from inside toward outside.
'
' Monitor -+------ Must be DIM SHARED or COMM